home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
stv.lha
/
STV
/
st_v
/
util
/
STVUTIL5.ZIP
/
PROCES.ST
< prev
next >
Wrap
Text File
|
1993-02-07
|
2KB
|
45 lines
"This replaces the schedule method for ProcessScheduler.
The only change is the addition of one line at the end
of the method, for the idle loop. With this change, you
will be able to control-break out of alot of situations
that used to hang V up tighter than a drum. This will also
keep windows alive and kicking.
The #readWinQueue method in NotificationManager is the method
that retrieves messages from the application queue and then
dispatches them. You must call this method in the idle loop,
or no messages get dispatched. Thus a lock-up of windows,
or, at the very least, a lockup of smalltalk.
Since V/Win has no callback mechanism, you have to use windows
messages to communicate events to Smalltalk. If you are blocking
on an event to be received (ie, a callback from a device
driver), you could possibly lockup the machine and never get
the event. This fix solves this problem and allows you to
use the messages to signal semaphores and such from an ISR.
-Hal" !
! ProcessScheduler methods !
schedule
| index processes process |
index := readyProcesses size.
[index < 1]
whileFalse: [
(processes := readyProcesses at: index) isEmpty
ifFalse: [
process := processes removeFirst.
process resume].
index := index - 1].
"No process is ready to run (i.e. we lost the idle process)
so create a new idle process."
CurrentProcess := Process new.
CurrentProcess priority: 1.
Process dropSenderChain.
Process enableInterrupts: true.
[true] whileTrue: [
UserLibrary waitMessage. "Block waiting for a message from windows"
KeyboardSemaphore signal. "Bump the system"
"** Added by HSH **"
Notifier readWinQueue. "Dispatch the message - HSH"
].! !